﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace S3Sync
{
    public class Services
    {
        #region Singleton

        private static volatile Services _singleton;
        private static object syncRoot = new Object();

        public static Services Current
        {
            get
            {
                if (_singleton == null)
                {
                    lock (syncRoot)
                    {
                        if (_singleton == null)
                        {
                            _singleton = new Services();
                        }
                    }
                }

                return _singleton;
            }
        }
        #endregion

        public IPersistenceLayer DataRepository { get; set; }

        public Services()
        {
            DataRepository = new XmlPersistenceLayer();
        }

        public Entities.Patch CreateNewPatch()
        {
            Entities.Patch patch = new S3Sync.Entities.Patch();
            patch.CreationDate = DateTime.Now;
            patch.Author = Environment.UserName;
            return patch;
        }
    }
}
